﻿using Spring.Context;
using Spring.Context.Support;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpringNetDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            //传统的创建对象 调用方法
            //IUserInfoDal userInfoDal = new UserInfoDal();
            //userInfoDal.show();

            //使用IOC/DI注入 容器创建实例

            //1，初始化容器
            IApplicationContext ctx = ContextRegistry.GetContext();
            //IUserInfoDal dal = ctx.GetObject("UserInfoDal") as IUserInfoDal;
            //dal.show();

            IUserInfoDal dal1 = ctx.GetObject("UserInfoDal1") as IUserInfoDal;
            dal1.show();

            //UserInfoService bll = ctx.GetObject("UserInfoService") as UserInfoService;
            //bll.Show();
            Console.ReadKey();
        }
    }
}
